package com.example.redis.application;

import com.example.redis.RedisBeanCache;
import com.example.redis.domain.Address;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class AddressApplication {
    @RedisBeanCache
    private RedisTemplate<Long, Address> redisTemplate;


    public void save(Address address){
        this.redisTemplate.opsForValue().set(address.getId(), address);
    }

    public Address getById(Long address){
        return this.redisTemplate.opsForValue().get(address);
    }
}
